<template>
  <div class="container">
    <van-search
      show-action
      placeholder="请输入素材标题"
    >
      <template #action>
        <div>搜索</div>
      </template>
    </van-search>
    <div class="list-container">
      <div class="section">
        <p v-if="listData.length===0" class="yyp">
          <van-empty description="暂无数据~"/>
        </p>
        <van-swipe-cell v-else v-for="item in listData" :key="item.id">
          <div class="yycard">
            <div class="yycard_p">
              <p>素材标题：{{item.strMaterialname}}</p>
              <p>素材类型：{{item.typeName}}</p>
              <p>所属机构：{{item.strOrgname}}</p>
              <p class="van-card__desc van-ellipsis ellipsisp">下载地址：{{item.strDownload}}</p>
              <p>播放次数：{{item.iPlaytime}}</p>
            </div>
          </div>
        </van-swipe-cell>
      </div>
    </div>
  </div>
</template>

<script>
  import {getmaterialList} from '../../api/programme'

  export default {
    name: 'MaterialList',
    data() {
      return {
        listData: [],
        iProgramsysnum: ''  //节目单编号
      }
    },
    created() {
      this.iProgramsysnum = this.$route.query.iProgramsysnum
      this.getinfoList()
    },

    methods: {
      //(详情节目单)所关联素材
      getinfoList() {
        getmaterialList({iProgramsysnum: this.iProgramsysnum}).then(res => {
            this.listData = res.materialInfoList
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .container {
    height: 100%;

    .list-container {
      display: flex;
      flex-direction: column;

      .section {
        flex: 1;
        height: 480px;
        max-height: 480px;
        overflow: auto;
        padding-bottom: 100px;
      }

      .bottom {
        flex: 1;
        display: flex;
        justify-content: center;
        align-content: center;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fafafa;

        .van-button {
          width: 90%;
        }
      }
    }
  }

  .yyp {
    text-align: center;
    font-size: 14px;
    color: #8c8a8a;
    line-height: 2;
  }

  .yycard {
    display: flex;
    border-bottom: 1px solid #f2f3f5;
    padding: 5px 0;
    margin-left: 20px;
  }

  /deep/ .van-image__img {
    border-radius: 8px;
  }

  .yycard_p {
    font-size: 14px;
    line-height: 20px;
    vertical-align: middle;
    padding-left: 10px;
    color: #6b6b6b;
  }

  .yycard_title {
    font-size: 14px;
    color: #000;
  }

  .van-button--primary {
    background-color: #0c1b35;
    border-color: #0c1b35;
    border-radius: 4px;
    width: 90%;
    margin: 20px;
  }

  .van-button--danger {
    height: 100%;
  }

  .delete-button2 {
    background-color: #6b6b6b;
    border: 1px solid #6b6b6b;
  }

  /deep/ .van-search__content {
    border-radius: 20px;
    background-color: #e7e9ec;
  }
  .ellipsisp{
    width: 320px;
  }

</style>
